package cn.wolfcode.crm.query;

import lombok.Getter;
import lombok.Setter;
import org.springframework.util.StringUtils;

@Setter
@Getter
public class QueryObject {
    //当前页
    private int page = 1;

    //页面显示容量
    private int rows = 10;

    //需要排序的列
    private String sort;

    //升降序列
    private String order;

    public String getSort(){
        return StringUtils.hasLength(sort) ? sort : null;
    }

    public String getOrder(){
        return StringUtils.hasLength(order) ? order : null;
    }

    public int getStart() {
        return (page - 1) * rows;
    }

    public String empty2Null(String s){
        return StringUtils.hasLength(s) ? s : null;
    }
}
